(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(ansi-color-faces-vector
   [default default default italic underline success warning error])
 '(ansi-color-names-vector
   ["#242424" "#e5786d" "#95e454" "#cae682" "#8ac6f2" "#333366" "#ccaa8f" "#f6f3e8"])
 '(custom-enabled-themes (quote (deeper-blue)))
 '(inhibit-startup-screen t)
 '(mouse-wheel-progressive-speed nil))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

(defun disable-all-themes ()
  "disable all active themes"
  (dolist (theme custom-enabled-themes)
    (disable-theme theme)))

;; disable color theme if in console
(if (not window-system)
    (disable-all-themes))

;; disable backup
(setq backup-inhibited t)
(setq make-backup-files nil)

(setq auto-save-default nil) ; disable autosave

;; fill mode
(add-hook 'text-mode-hook 'turn-on-auto-fill)
(setq-default fill-column 79)

;; disable space-to-tab for indentations
(setq-default indent-tabs-mode nil)

;; except for C
(defun c-lineup-arglist-tabs-only (ignored)
  "Line up argument lists by tabs, not spaces"
  (let* ((anchor (c-langelem-pos c-syntactic-element))
         (column (c-langelem-2nd-pos c-syntactic-element))
         (offset (- (1+ column) anchor))
         (steps (floor offset c-basic-offset)))
    (* (max steps 1)
       c-basic-offset)))

(add-hook 'c-mode-common-hook
          (lambda ()
            ;; Add kernel style
            (c-add-style
             "linux-tabs-only"
             '("linux" (c-offsets-alist
                        (arglist-cont-nonempty
                         c-lineup-gcc-asm-reg
                         c-lineup-arglist-tabs-only))))))

(add-hook 'c-mode-hook
          (lambda ()
            (setq indent-tabs-mode t)
            (setq show-trailing-whitespace t)
            (c-set-style "linux-tabs-only")))

(add-hook 'c++-mode-common-hook
          (lambda ()
            ;; Add kernel style
            (c-add-style
             "linux-tabs-only"
             '("linux" (c-offsets-alist
                        (arglist-cont-nonempty
                         c-lineup-gcc-asm-reg
                         c-lineup-arglist-tabs-only))))))

(add-hook 'c++-mode-hook
          (lambda ()
            (setq indent-tabs-mode t)
            (setq show-trailing-whitespace t)
            (c-set-style "linux-tabs-only")))

(defalias 'list-buffers 'ibuffer) ; because ibuffers
(setq inhibit-splash-screen t) ; skip splash
(line-number-mode 1) ; line number at bottom
;;(global-linum-mode 1) ; line numbers on side
(column-number-mode 1) ; column number at bottom

;; typical cut/copy/paste functions
(cua-mode)
(setq x-select-enable-clipboard t)

(autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t)
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)

(require 'term)
(define-key term-raw-map (kbd "C-'") 'term-line-mode)
(define-key term-mode-map (kbd "C-'") 'term-char-mode)
(define-key term-raw-map (kbd "C-y") 'term-paste)

;; add directory for workstation-specific code
(add-to-list 'load-path "~/.emacs.d/lisp/")

;; show clock at bottom
(display-time-mode 1)

;; show battery at bottom
(display-battery-mode 1)

;; custom modes for file extensions
(add-to-list 'auto-mode-alist '("\\.ino\\'" . c++-mode))
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
